package com.devframe.sysbase.model.base;

import java.io.Serializable;
import java.util.Set;

import com.devframe.sysbase.model.*;
/**
 * This is an object that contains data related to the T_SYS_USER table.
 * Do not modify this class because it will be overwritten if the configuration file
 * related to this class is modified.
 *
 * @hibernate.class
 *  table="T_SYS_USER"
 */
public abstract class BaseTSysUser implements Serializable{
	 	public static String REF = "TSysUser";
	 	public static String PROP_PASSWORD = "password";
	 	public static String PROP_USER_ID = "userId";
	 	public static String PROP_USER_NAME = "userName";
	 	public static String PROP_ID_CARD = "card";
	 	public static String PROP_DEPARTMENT = "department";
	 	public static String PROP_POLICENO = "policeNo";
	 	public static String PROP_IS_MANAGER = "isManager";
		// constructors
		public BaseTSysUser() {
		    initialize();
		}
		
		/**
		 * Constructor for primary key
		 */
		public BaseTSysUser(java.lang.String userId) {
		    this.setUserId(userId);
		    initialize();
		}
		
		protected void initialize () {}
		
		private int hashCode = Integer.MIN_VALUE;
		
		// primary key
	    private java.lang.String userId;
	    
	    //fields
	    private java.lang.String password;
	    private java.lang.String userName;
	    private java.lang.String card;
	    private java.lang.String department;
	    private java.lang.String policeNo;
	    private java.lang.String isManager;
	    

	    private Set roles;
	    
	    /**
	     * Return the unique identifier of this class
	     * @hibernate.id
	     *  generator-class="uuid.hex"
	     *  column="USER_ID"
	     */
		public java.lang.String getUserId() {
			return userId;
		}
		 /**
	     * Set the unique identifier of this class
	     * @param userId the new ID
	     */
		public void setUserId(java.lang.String userId) {
			this.userId = userId;
			this.hashCode = Integer.MIN_VALUE;
		}
	    /**
	     * Return the value associated with the column: PASSWORD
	     */
		public java.lang.String getPassword() {
			return password;
		}
		/**
	     * Set the value related to the column: PASSWORD
	     * @param password the PASSWORD value
	     */
		public void setPassword(java.lang.String password) {
			this.password = password;
		}
		 /**
	     * Return the value associated with the column: USER_NAME
	     */
		public java.lang.String getUserName() {
			return userName;
		}
		/**
	     * Set the value related to the column: USER_NAME
	     * @param userName the USER_NAME value
	     */
		public void setUserName(java.lang.String userName) {
			this.userName = userName;
		}
		 /**
	     * Return the value associated with the column: ID_CARD
	     */
		public java.lang.String getCard() {
			return card;
		}
		/**
	     * Set the value related to the column: ID_CARD
	     * @param card the ID_CARD value
	     */
		public void setCard(java.lang.String card) {
			this.card = card;
		}
		 /**
	     * Return the value associated with the column: DEPARTMENT
	     */
		public java.lang.String getDepartment() {
			return department;
		}
		/**
	     * Set the value related to the column: DEPARTMENT
	     * @param department the DEPARTMENT value
	     */
		public void setDepartment(java.lang.String department) {
			this.department = department;
		}
		 /**
	     * Return the value associated with the column: JH
	     */
		public java.lang.String getPoliceNo() {
			return policeNo;
		}
		/**
	     * Set the value related to the column: JH
	     * @param jh the JH value
	     */
		public void setPoliceNo(java.lang.String policeNo) {
			this.policeNo = policeNo;
		}
		 /**
	     * Return the value associated with the column: IS_MANAGER
	     */
		public java.lang.String getIsManager() {
			return isManager;
		}
		/**
	     * Set the value related to the column: IS_MANAGER
	     * @param isManager the IS_MANAGER value
	     */
		public void setIsManager(java.lang.String isManager) {
			this.isManager = isManager;
		}
		
		public boolean equals (Object obj) {
			if (null == obj) return false;
			if (!(obj instanceof TSysUser)) return false;
			else {
				TSysUser tSysUser = (TSysUser) obj;
				if (null == this.getUserId() || null == tSysUser.getUserId()) return false;
				else return (this.getUserId().equals(tSysUser.getUserId()));
			}
		}

		public int hashCode () {
			if (Integer.MIN_VALUE == this.hashCode) {
				if (null == this.getUserId()) return super.hashCode();
				else {
					String hashStr = this.getClass().getName() + ":" + this.getUserId().hashCode();
					this.hashCode = hashStr.hashCode();
				}
			}
			return this.hashCode;
		}
		public String toString () {
			return super.toString();
		}

		public Set getRoles() {
			return roles;
		}

		public void setRoles(Set roles) {
			this.roles = roles;
		}
		
		public void addToroles (TSysUserRole tSysUserRole) {
			if (null == getRoles()) setRoles(new java.util.TreeSet());
			getRoles().add(tSysUserRole);
		}
}
